<?php
namespace App\Listener;

use Hyperf\Event\Contract\ListenerInterface;
use Hyperf\Event\Annotation\Listener;

/**
 * @Listener 
 */
class ShopShopListener implements ListenerInterface
{
    public function listen(): array
    {
        return [
            \App\Event\Shop\CreateEvent::class,
        ];
    }
    
    // 更新店铺上级
    public function process($event)
    {
        // 否有上级店铺
        if($shop = $event->toShop)
        {
            $event->shop->setShop($shop);
        }
    }
}